package com.lcxw.hxzbim;

import java.net.InetSocketAddress;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.jms.annotation.EnableJms;
import com.lcxw.hxzbim.entity.ImConfig;
import com.lcxw.hxzbim.netty.server.NettyServer;

@Slf4j
@SpringBootApplication
@EnableJms
@EnableEurekaClient
@MapperScan("com.lcxw.hxzbapi.dao.mapper")
public class YwpdImApp implements CommandLineRunner {

    private final NettyServer nettyServer;

    public YwpdImApp(NettyServer nettyServer) {
        this.nettyServer = nettyServer;
    }

    public static void main(String[] args) {
        SpringApplication.run(YwpdImApp.class, args);
    }

    @Override
    public void run(String ... strings){
        InetSocketAddress address = new InetSocketAddress(ImConfig.imIp,ImConfig.IM_PORT);
        nettyServer.start(address);
        log.info("netty 服务启动，端口为："+ ImConfig.IM_PORT);
    }

}
